import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { createForm } from 'rc-form';
import content from '../../common/contentCss/content.css';
import styles from './common.css';
import CustTitle from '../../common/title/title';
import Announce from './pages/announce';

function Index({loading,dispatch,message}) {

  const { noticeInfo } = message;

  const titleProps = {
    titleName:'公告',
    goBack(){
      dispatch(routerRedux.goBack());
    },
  }

  const announceProps = {
    noticeInfo
  }

  return (
    <div className={content.content}>
      <CustTitle {...titleProps}/>
      <div style={{marginTop: '2.9em'}}>
        <Announce {...announceProps}/>
      </div>
    </div>
  )
}

function mapStateToProps(state, ownProps) {
  return {
    loading: state.loading.global,
    message: state.message,
  }
}
const IndexText = createForm()(Index);

export default connect(mapStateToProps)(IndexText);
